package org.example.db.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.example.db.entity.Permission;

import java.util.List;

public interface UserPermissionMapper {

    @Select("select permission.id, permission.name, permission.url from permission " +
            "inner join role_permission on role_permission.permission_id = permission.id " +
            "inner join user_role on user_role.role_id = role_permission.role_id where user_role.user_id = #{user_id} limit 100")
    List<Permission> selectPermissionByUserId(Long user_id);

    @Select("select permission.id, permission.name, permission.url from permission " +
            "inner join role_permission on role_permission.permission_id = permission.id " +
            "inner join wx_user_role on wx_user_role.role_id = role_permission.role_id where wx_user_role.wx_user_id = #{user_id} limit 100")
    List<Permission> selectPermissionByWxUserId(Long user_id);

}
